<template>
  <transition>
    
    <div class="car-item"  v-if="index === currentIndex">
      <img :src="courouselImgUrl" />
    </div>
  </transition>
</template>

<script>
export default {
  name: "CarItem",
  props: {
    index: Number,
    currentIndex: Number,
    courouselImgUrl: String,
  },
};
</script>

<style lang="scss">
.car-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  img {
    width: 100%;
  }
}

.v-enter-active,
.v-leave-active {
  transition: all 0.3s linear;
}

.v-enter-active {
  transform: translateX(100%);
}

.v-enter-to {
  transform: translateX(0);
}

.v-leave-active {
  transform: translateX(0);
}

.v-leave-to {
  transform: translateX(-100%);
}
</style>